<div class="modal-header">
    <div class="row">
        <div class="col-xs-10">
            <h4 class="modal-title">分配车辆(
                <span ng-if="emptyBusList.length">
                    剩余空车：
                    <span ng-repeat="bus in emptyBusList">{{bus.seats}}座{{bus.num}}辆
                        <span ng-if="$index != emptyBusList.length - 1">，</span>
                        <span ng-if="$index == emptyBusList.length - 1">。</span>
                    </span>
                </span>
                <span ng-if="!emptyBusList.length">没有剩余空车</span>
                </span>
                <!-- <span ng-if="noEmptyBusList.length">剩余有空座车：
                    <span ng-repeat="bus in noEmptyBusList">{{bus.seats}}座{{bus.num}}辆
                        <span ng-if="$index != noEmptyBusList.length - 1">，</span>
                        <span ng-if="$index != noEmptyBusList.length - 1">。</span>
                    </span>
                </span>
                <span ng-if="!noEmptyBusList.length">没有剩余有空座车</span>
                </span> -->
                )
            </h4>
        </div>
        <div class="col-xs-2">
        </div>
    </div>
</div>
<div class="modal-body">
    <div class="row">
        <div class="col-xs-12">
            <div class="col-xs-3">
                <ui-select ng-model="pageInfo.activity" theme="bootstrap" ng-disabled="pageInfo.isSelected">
                    <ui-select-match placeholder="选择活动">{{$select.selected.title}}【{{$select.selected.tour_date}}】【{{$select.selected.user_num}}人】</ui-select-match>
                    <ui-select-choices repeat="item in activityList | filter: $select.search">
                        <span ng-bind-html="item.title | highlight: $select.search"></span>
                        【
                        <span ng-bind-html="item.tour_date | highlight: $select.search"></span>】 【
                        <span ng-bind-html="item.user_num | highlight: $select.search"></span>人】
                    </ui-select-choices>
                </ui-select>
            </div>
            <!-- <div class="col-xs-3" ng-if="noEmptyBusList.length">
                <ui-select ng-model="pageInfo.bus" theme="bootstrap">
                    <ui-select-match placeholder="选择活动">{{$select.selected.seats_num}}【{{$select.selected.surplus_seats}}】</ui-select-match>
                    <ui-select-choices repeat="bus in noEmptyBusList | filter: $select.search">
                        <span ng-bind-html="item.seats_num | highlight: $select.search"></span>座 【剩余
                        <span ng-bind-html="item.surplus_seats | highlight: $select.search"></span>】
                    </ui-select-choices>
                </ui-select>
            </div> -->
            <div class="col-xs-3">
                <div class="input-group">
                    <span class="input-group-addon">上车地点</span>
                    <input class="form-control" type='text' ng-model="pageInfo.address" placeholder="上车地点">
                </div>
            </div>
            <div class="col-xs-3">
                <div class="input-group">
                    <span class="input-group-addon">发车时间</span>
                    <input class="form-control" type='text' ng-model="pageInfo.start_time" placeholder="发车时间">
                </div>
            </div>
            <div class="col-xs-3">
                <div class="input-group">
                    <select class="form-control" ng-model="pageInfo.emptyBusSeats">
                        <option ng-repeat="bus in emptyBusList" ng-value="bus.seats" >{{bus.seats}}座</option>
                    </select>
                    <span class="btn btn-success input-group-addon" ng-click="addEmptyBus(pageInfo.emptyBusSeats)">添加空车</span>
                </div>
            </div>
        </div>
        <div class="col-xs-12 mt20">
            <table class="table table-striped table-bordered dataTable table-condensed tree_table" style="table-layout:fixed">
                <thead>
                    <tr>
                        <th class="col-md-3 text-center">车型</th>
                        <th class="col-md-7 text-center">部门</th>
                        <th class="col-md-2 text-center">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="bus in busList">
                        <td class="text-center">
                            <div style="font-size: 20px;">{{bus.name}}</h2>
                        </td>
                        <td class="text-center">
                            <div ng-repeat="company in bus.companyList" class="input-group mt5">
                                <span class="input-group-addon">
                                    {{company.company_name}}【{{company.company_code}}】【{{company.user_num}}人】
                                </span>
                                <input class="form-control" type='number' ng-model="company.num" placeholder="该部门上该车人数" min="0" max="{{company.user_num > bus.seats? bus.seats: company.user_num}}">
                            </div>
                        </td>
                        <td class="text-center">
                            <a class="btn btn-xs btn-danger" ng-click="delete($index)">移除</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

<div class="modal-footer">
    <button class="btn btn-success" type="button" ng-click="ok()">确认发车</button>
    <button class="btn btn-danger" type="button" ng-click="close()">关闭</button>
</div>